package com.hengda.museumonline.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.google.gson.Gson;
import com.hengda.museumonline.MyApplication;
import com.hengda.museumonline.R;
import com.hengda.museumonline.http.CallServer;
import com.litesuits.common.utils.PackageUtil;
import com.yolanda.nohttp.NoHttp;
import com.yolanda.nohttp.RequestMethod;
import com.yolanda.nohttp.rest.OnResponseListener;
import com.yolanda.nohttp.rest.Request;
import com.yolanda.nohttp.rest.Response;

/**
 * @author：JFWU on 2016/10/10 14:22
 * @E-mail：jeffy12138@126.com
 */
public class DetailsActivity extends BaseActivity {
    private String tid;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_details);
        tid = getIntent().getExtras().getString("tid");
        getDataFromServer();
    }

    private void getDataFromServer() {
        Request request = NoHttp.createStringRequest(MyApplication.url + "news/content", RequestMethod.GET);
        request.add("p", "a");
        request.add("v", PackageUtil.getAppPackageInfo(DetailsActivity.this).versionName);
        request.add("tid", tid);
        CallServer.getRequestInstance().add(DetailsActivity.this, 0, request, new OnResponseListener() {
            @Override
            public void onStart(int what) {
                dialog.show();
            }

            @Override
            public void onSucceed(int what, Response response) {
                System.out.println("response:" + response.get().toString());
                if (200 == response.getHeaders().getResponseCode()) {

                    Gson gson = new Gson();
                }

            }

            @Override
            public void onFailed(int what, String url, Object tag, Exception exception, int responseCode, long networkMillis) {
                System.out.println("onFailed:" + exception);
            }

            @Override
            public void onFinish(int what) {
                dialog.dismiss();
            }
        });
    }
}
